#ifndef encoders_h
#define encoders_h

#include "structures.h"
#define ENC_MAX_TICKS 360
#define ENC_FORWARD 0
#define ENC_REVERSE 1

/************************************************************************************************* 

	Name: ENCODERS_H
	Autor: JA&AP
	
	Contains: 
				File containing all the functions related to the encoder hardware.
				
				
**************************************************************************************************/



/*************************************************************************
Routine: 	GETENCODERS
Purpose:  	Gets the current value of the registers that deal with 
			the encoder hardware.
In:			pointer to right and left encoder variables.
Out:		void
**************************************************************************/
unsigned int encoders_getStateLeft(void);


/*************************************************************************
Routine: 	GETENCODERS
Purpose:  	Gets the current value of the registers that deal with 
			the encoder hardware.
In:			pointer to right and left encoder variables.
Out:		void
**************************************************************************/
unsigned int encoders_getStateRight(void);

/*************************************************************************
Routine: 	GETENCODERS
Purpose:  	Gets the current value of the registers that deal with 
			the encoder hardware.
In:			pointer to right and left encoder variables.
Out:		void
**************************************************************************/
void encoders_getState(unsigned int *enc[]);



/*************************************************************************
Routine: 	RESETENCODERS
Purpose:  	Resets the current value of the register of encoders,turning 
			them to zero.
In:			void
Out:		void
**************************************************************************/
void encoders_setValueL(unsigned int val);

/*************************************************************************
Routine: 	RESETENCODERS
Purpose:  	Resets the current value of the register of encoders,turning 
			them to zero.
In:			void
Out:		void
**************************************************************************/
void encoders_setValueR(unsigned int val);

void encoders_setValues(unsigned int left,unsigned int right);
/*************************************************************************
Routine: 	RESETENCODERS
Purpose:  	Resets the current value of the register of encoders,turning 
			them to zero.
In:			void
Out:		void
**************************************************************************/

void encoders_reset(void);


/*************************************************************************
Routine: 	CONFIGENCODERS
Purpose:  	Configure the hardware that deals with the encoders.
In:			float frequency of update
Out:		void
**************************************************************************/
void encoders_init(void);


void encoders_start(void);

void encoders_stop(void);

void encoders_setDirection(unsigned char left, unsigned char right);

#define encoders_resetRight() encoders_setValueR(0)
#define encoders_resetLeft() encoders_setValueL(0)


#endif
